/**
 * @FilePath: \ros2\src\tools\shared_parameters\src\include\shared_parameters\node_with_shared_params.hpp
 * @Description  :  
 * @Author       : haibo
 * @Version      : 1.0.0
 * @LastEditors: haibo ashengzi@163.com
 * @LastEditTime: 2025-02-20 20:37:31
 * @Copyright (c) 2025 by 临工智能信息科技有限公司, All Rights Reserved. 
**/
#pragma once

class ROS2NodeWithSharedParams : public rclcpp::Node {
public:
    ROS2NodeWithSharedParams(const std::string& node_name) 
        : Node(node_name), node_name_(node_name) {
        
        // 初始化共享内存连接
        if (!SharedParamsInterface::initialize()) {
            throw std::runtime_error("Failed to initialize shared memory");
        }
    }

protected:
    template<typename T>
    T getSharedParam(const std::string& param_name) {
        return SharedParamsInterface::getParam<T>(node_name_, param_name);
    }

private:
    std::string node_name_;
};
